package cn.corgy.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum RegisterAndDiscoveryTypeEnum {
    NACOS((byte) 0x01, "nacos"),
    ZOOKEEPER((byte) 0x02, "zookeeper");

    private final byte code;
    private final String name;

    public static String getName(byte code) {
        for (RegisterAndDiscoveryTypeEnum c : RegisterAndDiscoveryTypeEnum.values()) {
            if (c.getCode() == code) {
                return c.name;
            }
        }
        return null;
    }
}
